<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./templates/template_general.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:define name="title">
        Mon profil
    </ui:define>

    <ui:define name="content">

        #{utilisateurMBean.resetUtilisateur()}
        <div class="profil_user">
            <p:panel header="Mon profil" style="text-align:center;width: 100%">
                <h:form>
                    <h:panelGrid styleClass="panelgrid_user_info" columns="2" style="width:100%;">
                        Login : <p:inputText size="30" value="#{utilisateurMBean.userconnecte.login}"/>
                        Nom : <p:inputText size="30" value="#{utilisateurMBean.userconnecte.nom}"/>
                        Prénom : <p:inputText size="30" value="#{utilisateurMBean.userconnecte.prenom}"/>
                        E-mail : <p:inputText size="30" value="#{utilisateurMBean.userconnecte.email}"/>
                        Téléphone : <p:inputText size="11" value="#{utilisateurMBean.userconnecte.telephone}"/>
                        Mot de passe : <p:inputText size="30" type="password" value="#{utilisateurMBean.userconnecte.motDePasse}"/>
                    </h:panelGrid>
                    <p:commandButton value="Enregistrer" ajax="false" action="#{utilisateurMBean.updateCurrentUser}" type="submit"/>
                </h:form>
            </p:panel>
        </div>



        <div class="column4">
            <c:if test="#{utilisateurMBean.type.equalsIgnoreCase('Commercant')}">
                <div class="title" style="float:left;">
                    <div style="float:left;">Mes Enseignes</div>
                </div>

                <div class="offer_box_wide_style2">
                    <h:form prependId="false">
                        <p:dataGrid var="enseigne" value="#{enseigneMBean.enseignesByUserCo()}" columns="3"  
                                    rows="12" paginator="true" paginatorTemplate="{CurrentPageReport} {FirstPageLink}
                                    {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}
                                    {RowsPerPageDropdown}" rowsPerPageTemplate="10,50,100">
                            <p:column>
                                <p:panel header="#{enseigne.nom}" style="text-align:center;width: 210px">  
                                    <h:panelGrid columns="1" style="width:100%">
                                        <p:commandLink action="#{enseigneMBean.detailEnseigne(enseigne)}" title="Visualiser">
                                            <p:graphicImage value="./resources/images/enseignes_img/#{enseigne.imageProfil}" width="150px"/>
                                        </p:commandLink>
                                        <h:panelGroup>
                                            <p:rating value="#{enseigne.note}" disabled="true"/><h:outputText value="(#{enseigne.notes.size()})"/>
                                        </h:panelGroup>
                                        <h:outputText value="#{enseigne.description}"/>
                                    </h:panelGrid>
                                </p:panel>  
                            </p:column>
                        </p:dataGrid>  
                    </h:form>
                </div>
                <div class="details_list">
                    <h:form>
                        <a href="./add_enseigne.xhtml">
                            <p:commandButton value="Ajouter une enseigne" type="button" ajax="false"/>
                        </a>
                    </h:form>
                </div>
            </c:if>

            <c:if test="#{utilisateurMBean.type.equalsIgnoreCase('Client')}">
                <div class="title" style="float:left;">
                    <div style="float:left;">Mes Favoris</div>
                </div>

                <div class="offer_box_wide_style2">
                    <h:form prependId="false">
                        <p:dataGrid var="favoris" value="#{utilisateurMBean.userCoFavoris()}" columns="3"  
                                    rows="12" paginator="true" paginatorTemplate="{CurrentPageReport} {FirstPageLink}
                                    {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}
                                    {RowsPerPageDropdown}" rowsPerPageTemplate="10,50,100">
                            <p:column>
                                <p:panel header="#{favoris.nom}" style="text-align:center;width: 210px">  
                                    <h:panelGrid columns="1" style="width:100%">
                                        <p:commandLink action="#{enseigneMBean.detailEnseigne(favoris)}" title="Visualiser">
                                            <p:graphicImage value="./resources/images/enseignes_img/#{favoris.imageProfil}" width="150px"/>
                                        </p:commandLink>
                                        <h:panelGroup>
                                            <p:rating value="#{favoris.note}" disabled="true"/><h:outputText value="(#{favoris.notes.size()})"/>
                                        </h:panelGroup>
                                        <h:outputText value="#{favoris.description}"/>
                                    </h:panelGrid>
                                </p:panel>  
                            </p:column>
                        </p:dataGrid>  
                    </h:form>
                </div>
                <div class="details_list">
                    <h:form>
                        <a href="./add_enseigne.xhtml">
                            <p:commandButton value="Ajouter une enseigne" type="button" ajax="false"/>
                        </a>
                    </h:form>
                </div>
            </c:if>
        </div>
    </ui:define>

</ui:composition>